<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: module mpyc.runtime</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head><body bgcolor="#f0f0f8">

<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial">&nbsp;<br><big><big><strong><a href="mpyc.html"><font color="#ffffff">mpyc</font></a>.runtime</strong></big></big></font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="https://github.com/lschoe/mpyc/blob/v0.6/mpyc/runtime.py">github.com/lschoe/mpyc/blob/v0.6/mpyc/runtime.py</a></font></td></tr></table>
    <p><tt>The&nbsp;MPyC&nbsp;runtime&nbsp;module&nbsp;is&nbsp;used&nbsp;to&nbsp;execute&nbsp;secure&nbsp;multiparty&nbsp;computations.<br>
&nbsp;<br>
Parties&nbsp;perform&nbsp;computations&nbsp;on&nbsp;secret-shared&nbsp;values&nbsp;by&nbsp;exchanging&nbsp;messages.<br>
Shamir's&nbsp;threshold&nbsp;secret&nbsp;sharing&nbsp;scheme&nbsp;is&nbsp;used&nbsp;for&nbsp;finite&nbsp;fields&nbsp;of&nbsp;any&nbsp;order<br>
exceeding&nbsp;the&nbsp;number&nbsp;of&nbsp;parties.&nbsp;MPyC&nbsp;provides&nbsp;secure&nbsp;number&nbsp;types&nbsp;and&nbsp;operations,<br>
many&nbsp;of&nbsp;which&nbsp;are&nbsp;available&nbsp;through&nbsp;Python's&nbsp;mechanism&nbsp;for&nbsp;operator&nbsp;overloading.</tt></p>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#aa55cc">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr>
    
<tr><td bgcolor="#aa55cc"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="https://docs.python.org/3/library/argparse.html">argparse</a><br>
<a href="https://docs.python.org/3/library/asyncio.html">asyncio</a><br>
<a href="mpyc.asyncoro.html">mpyc.asyncoro</a><br>
<a href="https://docs.python.org/3/library/configparser.html">configparser</a><br>
<a href="https://docs.python.org/3/library/datetime.html">datetime</a><br>
</td><td width="25%" valign=top><a href="https://docs.python.org/3/library/functools.html">functools</a><br>
<a href="https://docs.python.org/3/library/itertools.html">itertools</a><br>
<a href="https://docs.python.org/3/library/logging.html">logging</a><br>
<a href="https://docs.python.org/3/library/math.html">math</a><br>
<a href="mpyc.html">mpyc</a><br>
</td><td width="25%" valign=top><a href="https://docs.python.org/3/library/os.html">os</a><br>
<a href="https://docs.python.org/3/library/secrets.html">secrets</a><br>
<a href="mpyc.sectypes.html">mpyc.sectypes</a><br>
<a href="https://docs.python.org/3/library/ssl.html">ssl</a><br>
<a href="https://docs.python.org/3/library/sys.html">sys</a><br>
</td><td width="25%" valign=top><a href="mpyc.thresha.html">mpyc.thresha</a><br>
<a href="https://docs.python.org/3/library/time.html">time</a><br>
</td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ee77aa">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
    
<tr><td bgcolor="#ee77aa"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><dl>
<dt><font face="helvetica, arial"><a href="https://docs.python.org/3/library/functions.html#object">builtins.object</a>
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="mpyc.runtime.html#Party">Party</a>
</font></dt><dt><font face="helvetica, arial"><a href="mpyc.runtime.html#Runtime">Runtime</a>
</font></dt></dl>
</dd>
</dl>
 <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="Party">class <strong>Party</strong></a>(<a href="https://docs.python.org/3/library/functions.html#object">builtins.object</a>)</font></td></tr>
    
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt><a href="#Party">Party</a>(pid,&nbsp;host=None,&nbsp;port=None)<br>
&nbsp;<br>
Information&nbsp;about&nbsp;a&nbsp;party&nbsp;in&nbsp;the&nbsp;MPC&nbsp;protocol.<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="Party-__init__"><strong>__init__</strong></a>(self, pid, host=None, port=None)</dt><dd><tt>Initialize&nbsp;a&nbsp;party&nbsp;with&nbsp;given&nbsp;party&nbsp;identity&nbsp;pid.</tt></dd></dl>

<dl><dt><a name="Party-__repr__"><strong>__repr__</strong></a>(self)</dt><dd><tt>String&nbsp;representation&nbsp;of&nbsp;the&nbsp;party.</tt></dd></dl>

<hr>
Data descriptors defined here:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
</td></tr></table> <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="Runtime">class <strong>Runtime</strong></a>(<a href="https://docs.python.org/3/library/functions.html#object">builtins.object</a>)</font></td></tr>
    
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt><a href="#Runtime">Runtime</a>(pid,&nbsp;parties,&nbsp;options)<br>
&nbsp;<br>
MPyC&nbsp;runtime&nbsp;secure&nbsp;against&nbsp;passive&nbsp;attacks.<br>
&nbsp;<br>
The&nbsp;runtime&nbsp;maintains&nbsp;basic&nbsp;information&nbsp;such&nbsp;as&nbsp;a&nbsp;program&nbsp;counter,<br>
the&nbsp;list&nbsp;of&nbsp;parties,&nbsp;etc.,&nbsp;and&nbsp;handles&nbsp;secret-shared&nbsp;values&nbsp;of&nbsp;type&nbsp;Share.<br>
&nbsp;<br>
1-party&nbsp;case&nbsp;is&nbsp;supported&nbsp;(with&nbsp;option&nbsp;to&nbsp;disable&nbsp;asynchronous&nbsp;evaluation).<br>
Threshold&nbsp;0&nbsp;(no&nbsp;corrupted&nbsp;parties)&nbsp;is&nbsp;supported&nbsp;for&nbsp;m-party&nbsp;case&nbsp;as&nbsp;well<br>
to&nbsp;enable&nbsp;distributed&nbsp;computation&nbsp;(without&nbsp;secret&nbsp;sharing).<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="Runtime-__aenter__"><strong>__aenter__</strong></a>(self)</dt><dd><tt>Start&nbsp;MPyC&nbsp;runtime&nbsp;when&nbsp;entering&nbsp;async&nbsp;with&nbsp;context.</tt></dd></dl>

<dl><dt><a name="Runtime-__aexit__"><strong>__aexit__</strong></a>(self, exc_type, exc, tb)</dt><dd><tt>Shutdown&nbsp;MPyC&nbsp;runtime&nbsp;when&nbsp;exiting&nbsp;async&nbsp;with&nbsp;context.</tt></dd></dl>

<dl><dt><a name="Runtime-__init__"><strong>__init__</strong></a>(self, pid, parties, options)</dt><dd><tt>Initialize&nbsp;runtime.</tt></dd></dl>

<dl><dt><a name="Runtime-abs"><strong>abs</strong></a>(self, a)</dt><dd><tt>Secure&nbsp;absolute&nbsp;value&nbsp;of&nbsp;a.</tt></dd></dl>

<dl><dt><a name="Runtime-add"><strong>add</strong></a>(self, a, b)</dt><dd><tt>Secure&nbsp;addition&nbsp;of&nbsp;a&nbsp;and&nbsp;b.</tt></dd></dl>

<dl><dt><a name="Runtime-add_bits"><strong>add_bits</strong></a>(self, x, y)</dt><dd><tt>Secure&nbsp;binary&nbsp;addition&nbsp;of&nbsp;bit&nbsp;vectors&nbsp;x&nbsp;and&nbsp;y.</tt></dd></dl>

<dl><dt><a name="Runtime-and_"><strong>and_</strong></a>(self, a, b)</dt><dd><tt>Secure&nbsp;bitwise&nbsp;and&nbsp;of&nbsp;a&nbsp;and&nbsp;b.</tt></dd></dl>

<dl><dt><a name="Runtime-barrier"><strong>barrier</strong></a>(self)</dt><dd><tt>Barrier&nbsp;for&nbsp;runtime.</tt></dd></dl>

<dl><dt><a name="Runtime-convert"><strong>convert</strong></a>(self, x, ttype)</dt><dd><tt>Secure&nbsp;conversion&nbsp;of&nbsp;(elements&nbsp;of)&nbsp;x&nbsp;to&nbsp;given&nbsp;ttype.<br>
&nbsp;<br>
Value&nbsp;x&nbsp;is&nbsp;a&nbsp;secure&nbsp;number,&nbsp;or&nbsp;a&nbsp;list&nbsp;of&nbsp;secure&nbsp;numbers.<br>
Converted&nbsp;values&nbsp;assumed&nbsp;to&nbsp;fit&nbsp;in&nbsp;target&nbsp;type.</tt></dd></dl>

<dl><dt><a name="Runtime-div"><strong>div</strong></a>(self, a, b)</dt><dd><tt>Secure&nbsp;division&nbsp;of&nbsp;a&nbsp;by&nbsp;b,&nbsp;for&nbsp;nonzero&nbsp;b.</tt></dd></dl>

<dl><dt><a name="Runtime-eq"><strong>eq</strong></a>(self, a, b)</dt><dd><tt>Secure&nbsp;comparison&nbsp;a&nbsp;==&nbsp;b.</tt></dd></dl>

<dl><dt><a name="Runtime-eq_public"><strong>eq_public</strong></a>(self, a, b)</dt><dd><tt>Secure&nbsp;public&nbsp;equality&nbsp;test&nbsp;of&nbsp;a&nbsp;and&nbsp;b.</tt></dd></dl>

<dl><dt><a name="Runtime-from_bits"><strong>from_bits</strong></a>(self, x)</dt><dd><tt>Recover&nbsp;secure&nbsp;number&nbsp;from&nbsp;its&nbsp;binary&nbsp;representation&nbsp;x.</tt></dd></dl>

<dl><dt><a name="Runtime-gather"><strong>gather</strong></a>(self, *obj)</dt></dl>

<dl><dt><a name="Runtime-gauss"><strong>gauss</strong></a>(self, A, d, b, c)</dt><dd><tt>Secure&nbsp;Gaussian&nbsp;elimination&nbsp;A&nbsp;d&nbsp;-&nbsp;b&nbsp;c.</tt></dd></dl>

<dl><dt><a name="Runtime-ge"><strong>ge</strong></a>(self, a, b)</dt><dd><tt>Secure&nbsp;comparison&nbsp;a&nbsp;&gt;=&nbsp;b.</tt></dd></dl>

<dl><dt><a name="Runtime-if_else"><strong>if_else</strong></a>(self, c, x, y)</dt><dd><tt>Secure&nbsp;selection&nbsp;based&nbsp;on&nbsp;condition&nbsp;c&nbsp;between&nbsp;x&nbsp;and&nbsp;y.</tt></dd></dl>

<dl><dt><a name="Runtime-in_prod"><strong>in_prod</strong></a>(self, x, y)</dt><dd><tt>Secure&nbsp;dot&nbsp;product&nbsp;of&nbsp;x&nbsp;and&nbsp;y&nbsp;(one&nbsp;resharing).</tt></dd></dl>

<dl><dt><a name="Runtime-input"><strong>input</strong></a>(self, x, senders=None)</dt><dd><tt>Input&nbsp;x&nbsp;to&nbsp;the&nbsp;computation.<br>
&nbsp;<br>
Value&nbsp;x&nbsp;is&nbsp;a&nbsp;secure&nbsp;number,&nbsp;or&nbsp;a&nbsp;list&nbsp;of&nbsp;secure&nbsp;numbers.<br>
The&nbsp;senders&nbsp;are&nbsp;the&nbsp;parties&nbsp;that&nbsp;provide&nbsp;an&nbsp;input.<br>
The&nbsp;default&nbsp;is&nbsp;to&nbsp;let&nbsp;every&nbsp;party&nbsp;be&nbsp;a&nbsp;sender.</tt></dd></dl>

<dl><dt><a name="Runtime-invert"><strong>invert</strong></a>(self, a)</dt><dd><tt>Secure&nbsp;bitwise&nbsp;inverse&nbsp;(not)&nbsp;of&nbsp;a.</tt></dd></dl>

<dl><dt><a name="Runtime-is_zero"><strong>is_zero</strong></a>(self, a)</dt><dd><tt>Secure&nbsp;zero&nbsp;test&nbsp;a&nbsp;==&nbsp;0.</tt></dd></dl>

<dl><dt><a name="Runtime-is_zero_public"><strong>is_zero_public</strong></a>(self, a) -&gt; _asyncio.Future</dt><dd><tt>Secure&nbsp;public&nbsp;zero&nbsp;test&nbsp;of&nbsp;a.</tt></dd></dl>

<dl><dt><a name="Runtime-logging"><strong>logging</strong></a>(self, enable=None)</dt><dd><tt>Toggle/enable/disable&nbsp;logging.</tt></dd></dl>

<dl><dt><a name="Runtime-lsb"><strong>lsb</strong></a>(self, a)</dt><dd><tt>Secure&nbsp;least&nbsp;significant&nbsp;bit&nbsp;of&nbsp;a.</tt></dd></dl>

<dl><dt><a name="Runtime-matrix_add"><strong>matrix_add</strong></a>(self, A, B, tr=False)</dt><dd><tt>Secure&nbsp;addition&nbsp;of&nbsp;matrices&nbsp;A&nbsp;and&nbsp;(transposed)&nbsp;B.</tt></dd></dl>

<dl><dt><a name="Runtime-matrix_prod"><strong>matrix_prod</strong></a>(self, A, B, tr=False)</dt><dd><tt>Secure&nbsp;matrix&nbsp;product&nbsp;of&nbsp;A&nbsp;with&nbsp;(transposed)&nbsp;B.</tt></dd></dl>

<dl><dt><a name="Runtime-matrix_sub"><strong>matrix_sub</strong></a>(self, A, B, tr=False)</dt><dd><tt>Secure&nbsp;subtraction&nbsp;of&nbsp;matrices&nbsp;A&nbsp;and&nbsp;(transposed)&nbsp;B.</tt></dd></dl>

<dl><dt><a name="Runtime-max"><strong>max</strong></a>(self, *x)</dt><dd><tt>Secure&nbsp;maximum&nbsp;of&nbsp;all&nbsp;given&nbsp;elements&nbsp;in&nbsp;x.</tt></dd></dl>

<dl><dt><a name="Runtime-min"><strong>min</strong></a>(self, *x)</dt><dd><tt>Secure&nbsp;minimum&nbsp;of&nbsp;all&nbsp;given&nbsp;elements&nbsp;in&nbsp;x.</tt></dd></dl>

<dl><dt><a name="Runtime-min_max"><strong>min_max</strong></a>(self, *x)</dt><dd><tt>Secure&nbsp;minimum&nbsp;and&nbsp;maximum&nbsp;of&nbsp;all&nbsp;given&nbsp;elements&nbsp;in&nbsp;x.<br>
&nbsp;<br>
Total&nbsp;number&nbsp;of&nbsp;comparisons&nbsp;is&nbsp;only&nbsp;(3n-3)//2,&nbsp;compared&nbsp;to&nbsp;2n-2&nbsp;for&nbsp;the&nbsp;obvious&nbsp;approach.<br>
This&nbsp;is&nbsp;optimal&nbsp;as&nbsp;shown&nbsp;by&nbsp;Ira&nbsp;Pohl&nbsp;in&nbsp;"A&nbsp;sorting&nbsp;problem&nbsp;and&nbsp;its&nbsp;complexity",<br>
Communications&nbsp;of&nbsp;the&nbsp;ACM&nbsp;15(6),&nbsp;pp.&nbsp;462-464,&nbsp;1972.</tt></dd></dl>

<dl><dt><a name="Runtime-mod"><strong>mod</strong></a>(self, a, b)</dt><dd><tt>Secure&nbsp;modulo&nbsp;reduction.</tt></dd></dl>

<dl><dt><a name="Runtime-mul"><strong>mul</strong></a>(self, a, b)</dt><dd><tt>Secure&nbsp;multiplication&nbsp;of&nbsp;a&nbsp;and&nbsp;b.</tt></dd></dl>

<dl><dt><a name="Runtime-neg"><strong>neg</strong></a>(self, a)</dt><dd><tt>Secure&nbsp;negation&nbsp;(additive&nbsp;inverse)&nbsp;of&nbsp;a.</tt></dd></dl>

<dl><dt><a name="Runtime-or_"><strong>or_</strong></a>(self, a, b)</dt><dd><tt>Secure&nbsp;bitwise&nbsp;or&nbsp;of&nbsp;a&nbsp;and&nbsp;b.</tt></dd></dl>

<dl><dt><a name="Runtime-output"><strong>output</strong></a>(self, x, receivers=None, threshold=None)</dt><dd><tt>Output&nbsp;the&nbsp;value&nbsp;of&nbsp;x&nbsp;to&nbsp;the&nbsp;receivers&nbsp;specified.<br>
&nbsp;<br>
Value&nbsp;x&nbsp;is&nbsp;a&nbsp;secure&nbsp;number,&nbsp;or&nbsp;a&nbsp;list&nbsp;of&nbsp;secure&nbsp;numbers.<br>
The&nbsp;receivers&nbsp;are&nbsp;the&nbsp;parties&nbsp;that&nbsp;will&nbsp;obtain&nbsp;the&nbsp;output.<br>
The&nbsp;default&nbsp;is&nbsp;to&nbsp;let&nbsp;every&nbsp;party&nbsp;be&nbsp;a&nbsp;receiver.</tt></dd></dl>

<dl><dt><a name="Runtime-pos"><strong>pos</strong></a>(self, a)</dt><dd><tt>Secure&nbsp;unary&nbsp;+&nbsp;applied&nbsp;to&nbsp;a.</tt></dd></dl>

<dl><dt><a name="Runtime-pow"><strong>pow</strong></a>(self, a, b)</dt><dd><tt>Secure&nbsp;exponentiation&nbsp;a&nbsp;raised&nbsp;to&nbsp;the&nbsp;power&nbsp;of&nbsp;b,&nbsp;for&nbsp;public&nbsp;integer&nbsp;b.</tt></dd></dl>

<dl><dt><a name="Runtime-prfs"><strong>prfs</strong></a>(self, bound)</dt><dd><tt>PRFs&nbsp;with&nbsp;codomain&nbsp;range(bound)&nbsp;for&nbsp;pseudorandom&nbsp;secret&nbsp;sharing.<br>
&nbsp;<br>
Return&nbsp;a&nbsp;mapping&nbsp;from&nbsp;sets&nbsp;of&nbsp;parties&nbsp;to&nbsp;PRFs.</tt></dd></dl>

<dl><dt><a name="Runtime-prod"><strong>prod</strong></a>(self, x)</dt><dd><tt>Secure&nbsp;product&nbsp;of&nbsp;all&nbsp;elements&nbsp;in&nbsp;x&nbsp;(in&nbsp;log_2&nbsp;len(x)&nbsp;rounds).</tt></dd></dl>

<dl><dt><a name="Runtime-random_bit"><strong>random_bit</strong></a>(self, stype, signed=False)</dt><dd><tt>Secure&nbsp;uniformly&nbsp;random&nbsp;bit&nbsp;of&nbsp;the&nbsp;given&nbsp;type.</tt></dd></dl>

<dl><dt><a name="Runtime-random_bits"><strong>random_bits</strong></a>(self, sftype, n, signed=False)</dt><dd><tt>n&nbsp;secure&nbsp;uniformly&nbsp;random&nbsp;bits&nbsp;of&nbsp;the&nbsp;given&nbsp;type.</tt></dd></dl>

<dl><dt><a name="Runtime-reciprocal"><strong>reciprocal</strong></a>(self, a)</dt><dd><tt>Secure&nbsp;reciprocal&nbsp;(multiplicative&nbsp;inverse)&nbsp;of&nbsp;a,&nbsp;for&nbsp;nonzero&nbsp;a.</tt></dd></dl>

<dl><dt><a name="Runtime-run"><strong>run</strong></a>(self, f)</dt><dd><tt>Run&nbsp;the&nbsp;given&nbsp;coroutine&nbsp;or&nbsp;future&nbsp;until&nbsp;it&nbsp;is&nbsp;done.</tt></dd></dl>

<dl><dt><a name="Runtime-scalar_mul"><strong>scalar_mul</strong></a>(self, a, x)</dt><dd><tt>Secure&nbsp;scalar&nbsp;multiplication&nbsp;of&nbsp;scalar&nbsp;a&nbsp;with&nbsp;vector&nbsp;x.</tt></dd></dl>

<dl><dt><a name="Runtime-schur_prod"><strong>schur_prod</strong></a>(self, x, y)</dt><dd><tt>Secure&nbsp;entrywise&nbsp;multiplication&nbsp;of&nbsp;vectors&nbsp;x&nbsp;and&nbsp;y.</tt></dd></dl>

<dl><dt><a name="Runtime-sgn"><strong>sgn</strong></a>(self, a, EQ=False, GE=False, l=None)</dt><dd><tt>Secure&nbsp;sign(um)&nbsp;of&nbsp;a,&nbsp;-1&nbsp;if&nbsp;a&nbsp;&lt;&nbsp;0&nbsp;else&nbsp;0&nbsp;if&nbsp;a&nbsp;==&nbsp;0&nbsp;else&nbsp;1.</tt></dd></dl>

<dl><dt><a name="Runtime-shutdown"><strong>shutdown</strong></a>(self)</dt><dd><tt>Shutdown&nbsp;the&nbsp;MPyC&nbsp;runtime.<br>
&nbsp;<br>
Close&nbsp;all&nbsp;connections,&nbsp;if&nbsp;any.</tt></dd></dl>

<dl><dt><a name="Runtime-start"><strong>start</strong></a>(self)</dt><dd><tt>Start&nbsp;the&nbsp;MPyC&nbsp;runtime.<br>
&nbsp;<br>
Open&nbsp;connections&nbsp;with&nbsp;other&nbsp;parties,&nbsp;if&nbsp;any.</tt></dd></dl>

<dl><dt><a name="Runtime-sub"><strong>sub</strong></a>(self, a, b)</dt><dd><tt>Secure&nbsp;subtraction&nbsp;of&nbsp;a&nbsp;and&nbsp;b.</tt></dd></dl>

<dl><dt><a name="Runtime-sum"><strong>sum</strong></a>(self, x)</dt><dd><tt>Secure&nbsp;sum&nbsp;of&nbsp;all&nbsp;elements&nbsp;in&nbsp;x.</tt></dd></dl>

<dl><dt><a name="Runtime-throttler"><strong>throttler</strong></a>(self, load_percentage=1.0)</dt><dd><tt>Throttle&nbsp;runtime&nbsp;by&nbsp;given&nbsp;percentage&nbsp;(default&nbsp;1.0).</tt></dd></dl>

<dl><dt><a name="Runtime-to_bits"><strong>to_bits</strong></a>(self, a, l=None)</dt><dd><tt>Secure&nbsp;extraction&nbsp;of&nbsp;l&nbsp;(or&nbsp;all)&nbsp;least&nbsp;significant&nbsp;bits&nbsp;of&nbsp;a.</tt></dd></dl>

<dl><dt><a name="Runtime-trunc"><strong>trunc</strong></a>(self, x, f=None, l=None)</dt><dd><tt>Secure&nbsp;truncation&nbsp;of&nbsp;f&nbsp;least&nbsp;significant&nbsp;bits&nbsp;of&nbsp;(elements&nbsp;of)&nbsp;x.<br>
&nbsp;<br>
Probabilistic&nbsp;rounding&nbsp;of&nbsp;a&nbsp;/&nbsp;2**f&nbsp;for&nbsp;a&nbsp;in&nbsp;x.</tt></dd></dl>

<dl><dt><a name="Runtime-unit_vector"><strong>unit_vector</strong></a>(self, a, n)</dt><dd><tt>Length-n&nbsp;unit&nbsp;vector&nbsp;[0]*a&nbsp;+&nbsp;[1]&nbsp;+&nbsp;[0]*(n-1-a)&nbsp;for&nbsp;secret&nbsp;a,&nbsp;assuming&nbsp;0&nbsp;&lt;=&nbsp;a&nbsp;&lt;&nbsp;n.<br>
&nbsp;<br>
NB:&nbsp;If&nbsp;a&nbsp;=&nbsp;n,&nbsp;unit&nbsp;vector&nbsp;[1]&nbsp;+&nbsp;[0]*(n-1)&nbsp;is&nbsp;returned.&nbsp;See&nbsp;mpyc.statistics.</tt></dd></dl>

<dl><dt><a name="Runtime-vector_add"><strong>vector_add</strong></a>(self, x, y)</dt><dd><tt>Secure&nbsp;addition&nbsp;of&nbsp;vectors&nbsp;x&nbsp;and&nbsp;y.</tt></dd></dl>

<dl><dt><a name="Runtime-vector_sub"><strong>vector_sub</strong></a>(self, x, y)</dt><dd><tt>Secure&nbsp;subtraction&nbsp;of&nbsp;vectors&nbsp;x&nbsp;and&nbsp;y.</tt></dd></dl>

<dl><dt><a name="Runtime-xor"><strong>xor</strong></a>(self, a, b)</dt><dd><tt>Secure&nbsp;bitwise&nbsp;xor&nbsp;of&nbsp;a&nbsp;and&nbsp;b.</tt></dd></dl>

<hr>
Static methods defined here:<br>
<dl><dt><a name="Runtime-SecFld"><strong>SecFld</strong></a>(order=None, modulus=None, char=None, ext_deg=None, min_order=None, signed=False)</dt><dd><tt>Secure&nbsp;finite&nbsp;field&nbsp;of&nbsp;order&nbsp;q&nbsp;=&nbsp;p**d.<br>
&nbsp;<br>
Order&nbsp;q&nbsp;&gt;=&nbsp;min_order.<br>
Field&nbsp;is&nbsp;prime&nbsp;(d&nbsp;=&nbsp;1)&nbsp;by&nbsp;default&nbsp;and&nbsp;if&nbsp;modulus&nbsp;is&nbsp;prime.<br>
Extension&nbsp;degree&nbsp;d&nbsp;&gt;&nbsp;1&nbsp;if&nbsp;order&nbsp;is&nbsp;a&nbsp;prime&nbsp;power&nbsp;p**d&nbsp;with&nbsp;d&nbsp;&gt;&nbsp;1,<br>
if&nbsp;modulus&nbsp;is&nbsp;a&nbsp;polynomial&nbsp;or&nbsp;a&nbsp;string&nbsp;or&nbsp;an&nbsp;integer&nbsp;&gt;&nbsp;char,<br>
or&nbsp;if&nbsp;ext_deg&nbsp;is&nbsp;an&nbsp;integer&nbsp;&gt;&nbsp;1,&nbsp;or&nbsp;if&nbsp;min_order&nbsp;&gt;&nbsp;char.</tt></dd></dl>

<dl><dt><a name="Runtime-SecFxp"><strong>SecFxp</strong></a>(l=None, f=None, p=None, n=2)</dt><dd><tt>Secure&nbsp;l-bit&nbsp;fixed-point&nbsp;numbers&nbsp;with&nbsp;f-bit&nbsp;fractional&nbsp;part.<br>
&nbsp;<br>
NB:&nbsp;if&nbsp;dividing&nbsp;secure&nbsp;fixed-point&nbsp;numbers,&nbsp;make&nbsp;sure&nbsp;that&nbsp;l&nbsp;=~&nbsp;2f.</tt></dd></dl>

<dl><dt><a name="Runtime-SecInt"><strong>SecInt</strong></a>(l=None, p=None, n=2)</dt><dd><tt>Secure&nbsp;l-bit&nbsp;integers.</tt></dd></dl>

<dl><dt><a name="Runtime-coroutine"><strong>coroutine</strong></a> = mpc_coro(func, pc=True)</dt><dd><tt>Decorator&nbsp;turning&nbsp;coroutine&nbsp;func&nbsp;into&nbsp;an&nbsp;MPyC&nbsp;coroutine.<br>
&nbsp;<br>
An&nbsp;MPyC&nbsp;coroutine&nbsp;is&nbsp;evaluated&nbsp;asynchronously,&nbsp;returning&nbsp;empty&nbsp;placeholders.<br>
The&nbsp;type&nbsp;of&nbsp;the&nbsp;placeholders&nbsp;is&nbsp;defined&nbsp;either&nbsp;by&nbsp;a&nbsp;return&nbsp;annotation<br>
of&nbsp;the&nbsp;form&nbsp;"-&gt;&nbsp;expression"&nbsp;or&nbsp;by&nbsp;the&nbsp;first&nbsp;await&nbsp;expression&nbsp;in&nbsp;func.<br>
Return&nbsp;annotations&nbsp;can&nbsp;only&nbsp;be&nbsp;used&nbsp;for&nbsp;static&nbsp;types.</tt></dd></dl>

<dl><dt><a name="Runtime-returnType"><strong>returnType</strong></a>(*args, wrap=True)</dt><dd><tt>Define&nbsp;return&nbsp;type&nbsp;for&nbsp;MPyC&nbsp;coroutines.<br>
&nbsp;<br>
Used&nbsp;in&nbsp;first&nbsp;await&nbsp;expression&nbsp;in&nbsp;an&nbsp;MPyC&nbsp;coroutine.</tt></dd></dl>

<hr>
Data descriptors defined here:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<dl><dt><strong>threshold</strong></dt>
<dd><tt>Threshold&nbsp;for&nbsp;MPC.</tt></dd>
</dl>
<hr>
Data and other attributes defined here:<br>
<dl><dt><strong>random</strong> = &lt;module 'mpyc.random' from 'github.com/lschoe/mpyc/blob/v0.6/mpyc/random.py'&gt;</dl>

<dl><dt><strong>statistics</strong> = &lt;module 'mpyc.statistics' from 'github.com/lschoe/mpyc/blob/v0.6/mpyc/statistics.py'&gt;</dl>

<dl><dt><strong>version</strong> = '0.6'</dl>

</td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#eeaa77">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr>
    
<tr><td bgcolor="#eeaa77"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><dl><dt><a name="-generate_configs"><strong>generate_configs</strong></a>(m, addresses)</dt><dd><tt>Generate&nbsp;party&nbsp;configurations.<br>
&nbsp;<br>
Generates&nbsp;m-party&nbsp;configurations&nbsp;from&nbsp;the&nbsp;addresses&nbsp;given&nbsp;as<br>
a&nbsp;list&nbsp;of&nbsp;'(host,&nbsp;port)'&nbsp;pairs,&nbsp;specifying&nbsp;the&nbsp;hostnames&nbsp;and<br>
port&nbsp;numbers&nbsp;for&nbsp;each&nbsp;party.<br>
&nbsp;<br>
Returns&nbsp;a&nbsp;list&nbsp;of&nbsp;ConfigParser&nbsp;instances,&nbsp;which&nbsp;can&nbsp;be&nbsp;saved<br>
in&nbsp;m&nbsp;separate&nbsp;INI-files.&nbsp;The&nbsp;party&nbsp;owning&nbsp;an&nbsp;INI-file&nbsp;is<br>
indicated&nbsp;by&nbsp;not&nbsp;specifying&nbsp;its&nbsp;hostname&nbsp;(host='').</tt></dd></dl>
 <dl><dt><a name="-setup"><strong>setup</strong></a>()</dt><dd><tt>Setup&nbsp;a&nbsp;runtime.</tt></dd></dl>
</td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#55aa55">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr>
    
<tr><td bgcolor="#55aa55"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><strong>mpc</strong> = &lt;mpyc.runtime.Runtime object&gt;</td></tr></table>
</body></html>